<form id="<?php echo $uniqid;?>" method="post" style="padding: 8px;">
    <table border="0" width="100%" cellspacing="1" cellpadding="5" class="formtable">
        <tr bgcolor="#FFFFFF">
            <td  class="tlabel" >名称：</td>
            <td width="80%"><input type="text" style="width:400px;" v-model="params.name"
                                   class="forminput inputstyle textbox-text validatebox-text textbox-prompt easyui-validatebox"
                                   placeholder="请输入名称.." required="true"></td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >图片：</td>
            <td class="main" style="padding: 0">
                <div title="上传图片" style="display: flex; height: 80px; overflow: hidden;">
                    <div class="img-box" v-if="params.image">
                        <a class="linkWrapper" target="_blank" :href="params.image" title="查看原图">
                            <img height="70px" :src="params.image+'?imageView2/1/w/100/h/100'"></a>
                        <div class="img-box-del" @click="params.image=''">
                            <img class="label-auto" src="/static/Easyui/themes/2019/icons/del_tr.gif">
                        </div>
                    </div>
                    <div class="add-image-button" v-else>
                        <a class="btn btn-default btn-lg" @click="uploadBox('goodsserviceeditVm.params.image')" href="javascript:void(0);">
                            <i class="iconfont icon-tianjia"></i>
                        </a>
                    </div>
                </div>
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td  class="tlabel" >描述：</td>
            <td width="80%"><input type="text" style="width:400px;" v-model="params.description"
                                   class="forminput inputstyle textbox-text validatebox-text textbox-prompt easyui-validatebox"
                                   placeholder="请输入描述.." required="true"></td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td  class="tlabel" >排序：</td>
            <td width="80%"><input type="text"
                                   class="forminput inputstyle textbox-text validatebox-text textbox-prompt easyui-validatebox"
                                   v-model="params.sortorder" placeholder="请输入排序.."></td>
        </tr>
    </table>
</form>

<script>
    var goodsserviceeditVm = new Vue({
        el: '#<?php echo $uniqid;?>',
        data: {
            params: JSON.parse('<?php echo addslashes($dataset);?>'),
        },
        methods: {
            submit: function () {
                let act = this.params.id ? 'edit' : 'add';
                $.post('/admin/goodsservice/' + act, goodsserviceeditVm.params, function (data) {
                    if (data.ret === 0) {
                        $.messager.show({
                            title: '提示',
                            msg: data.msg,
                            timeout: 3000,
                            showType: 'slide'
                        });
                        $('#<?php echo $uniqid;?>').form('clear');
                        $("#goodsservicedlg").dialog('close');
                        $("#goodsservice").datagrid('reload');
                    } else {
                        $.messager.alert('提示', data.msg, 'warning');
                    }
                }, 'json');
            }
        }
    });
    $(function () {
        $('#goodsservicesubmit').click(function (data) {
            goodsserviceeditVm.submit();
        });
    });
</script>
